import java.sql.*;
public class MysqlDeleteDatabase {
	public static void main(String[] args) {
		  System.out.println("MySQL Connect Example.");
		  Connection conn = null;
		  String url = "jdbc:mysql://localhost:3306/";
		  String dbName = "pichubdb";
		  String driver = "com.mysql.jdbc.Driver";
		  String userName = "pichub"; 
		  String password = "Mark1990";
		  try {

		  Class.forName(driver).newInstance();
		  conn = DriverManager.getConnection(url,userName,password);
		  System.out.println("Connected to the database");
		 
		  Statement st = conn.createStatement();
		  String createDatabase = "DROP DATABASE " + "IF EXISTS " + dbName;
		  System.out.println( createDatabase );
		  st.executeUpdate(createDatabase);
		  conn.close();
		  System.out.println("Disconnected from database");
		  } catch (Exception e) {
			  System.out.println("Failed to connect to database");
		  e.printStackTrace();
		  }
	}
}
